Skip to content

Conversation

@arng40
Copy link
Contributor

@arng40 arng40 commented Nov 18, 2025

This PR aim to create a new CI Target in order to ensure the use of the internal tool in geos and to promote the best coding practice.
First, this PR set up the CI check_code_rules and will ensure the use of : stdMap, stdUnorderedMap& stdVector
This PR will be merged after :

@arng40 arng40 self-assigned this Nov 18, 2025
@arng40 arng40 added type: CI Concerns github workflows or generic CI DO NOT MERGE ! flag: no rebaseline Does not require rebaseline labels Nov 18, 2025
@MelReyCG MelReyCG changed the title feat: CI - Add code rules feat: CI - Add code rules checking Nov 27, 2025
@MelReyCG MelReyCG changed the title feat: CI - Add code rules checking feat: CI - Add code rules checking script Nov 27, 2025
@MelReyCG MelReyCG changed the title feat: CI - Add code rules checking script feat: CI - Add code rules checking action Nov 27, 2025
Copy link
Contributor

@MelReyCG MelReyCG left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you showed that script works, but it seems that there are some critical issues in it.

Comment on lines 177 to 184
# - name: Ubuntu debug (20.04, gcc 10.5.0, open-mpi 4.0.3) - github codespaces
# CMAKE_BUILD_TYPE: Debug
# DOCKER_REPOSITORY: geosx/ubuntu20.04-gcc10
# BUILD_SHARED_LIBS: ON
# ENABLE_HYPRE: OFF
# ENABLE_TRILINOS: ON
# GEOS_ENABLE_BOUNDS_CHECK: ON
# HOST_CONFIG: /spack-generated.cmake
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you cannot leave CI modifs aimed for test and request review.

Comment on lines 130 to 131
# - name: Check code rules
# BUILD_AND_TEST_ARGS: --test-code-rules
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is it commented out?

FULL_FILE_PATTERN="${FILE_PREFIX}${FILE_PATTERNS[*]}"
# Build the find command
FIND_CMD="find"
FIND_FILE_CMD="$FIND_CMD $FILE_PATH_PATERN"' \( -name "*.hpp" -o -name "*.cpp" \)'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FILE_PATH_PATTERN seems never initialized.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should you add -f?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-type f

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Beware of template files, they should be included

/*
* ------------------------------------------------------------------------------------------------------------
* SPDX-License-Identifier: LGPL-2.1-only
*
* Copyright (c) 2018-2019 Lawrence Livermore National Security LLC
* Copyright (c) 2018-2019 The Board of Trustees of the Leland Stanford Junior University
* Copyright (c) 2018-2019 Total, S.A
* Copyright (c) 2019- GEOSX Contributors
* All right reserved
*
* See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details.
* ------------------------------------------------------------------------------------------------------------
*/
/**
* @file @[email protected]
*/
#ifndef GEOS_@KERNEL_GROUP_NAME@_DISPATCHTYPELIST_HPP
#define GEOS_@KERNEL_GROUP_NAME@_DISPATCHTYPELIST_HPP
#include "common/TypeDispatch.hpp"
namespace geos
{
// TODO remove and find a proper solution to namespacing
using namespace constitutive;
using namespace finiteElement;
using @KERNEL_GROUP_NAME@DispatchTypeList = types::TypeList<
@typeCombinationList@
>;
} // namespace geos
#endif //GEOS_@KERNEL_GROUP_NAME@_DISPATCHTYPELIST_HPP

FILES=$(eval "$FIND_FILE_CMD" 2>/dev/null);

# Main loop
for file in $FILES; do
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does it behave with spaces in folder / file names?

ARRAY_UMAP=()
ARRAY_VECTOR=()

FULL_FILE_PATTERN="${FILE_PREFIX}${FILE_PATTERNS[*]}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure to get that right, but does it result to the following?
src/coreComponents/codingUtilities/* common/* dataRepository/* ...

If yes, how can it work as the file prefix is not added to each file pattern? maybe it would be easier with a cd FILE_PREFIX (rename to VALIDATING_FOLDER?)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There was a missing part to this code..

Comment on lines +107 to +109
print_violation "$MAP_VIOLATIONS_FOUND" ARRAY_MAP "std::map"
print_violation "$UMAP_VIOLATIONS_FOUND" ARRAY_UMAP "std::unordered_map"
print_violation "$VECTOR_VIOLATIONS_FOUND" ARRAY_VECTOR "std::vector"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Add an array for them,
  • did you missed std::array?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

array still not in GEOS

<xsd:element name="SinglePhaseHybridFVM" type="SinglePhaseHybridFVMType" />
<xsd:element name="SinglePhasePoromechanics" type="SinglePhasePoromechanicsType" />
<xsd:element name="SinglePhasePoromechanicsConformingFractures" type="SinglePhasePoromechanicsConformingFracturesType" />
<xsd:element name="SinglePhasePoromechanicsConformingFracturesALM" type="SinglePhasePoromechanicsConformingFracturesALMType" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why this there ? Branching oddity ?

--test-code-style
--test-documentation
-h | --help
-h | --help
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe reversible whitespace edition for PR's clarity sake

- are_submodules_in_sync
- check_code_style_and_documentation
- cpu_builds
- check_code_standards
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If check_code_standards is just rename of check_code_style_and_documentation why ?
And why check_code_rules is not required here ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at CI checks, it is indeed then an advisory but not required enforcement ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'll revert that

needs.check_code_style_and_documentation.result == 'success' &&
needs.cpu_builds.result == 'success' &&
needs.cuda_builds.result == 'success' &&
needs.check_code_standards.result == 'success' &&
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

was need.cpu_builds.results and its cuda counterpart removed while dev to speed up or is it permanent ??

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it was to speed up


FULL_FILE_PATTERN="${FILE_PREFIX}${FILE_PATTERNS[*]}"
# Build the find command
FIND_CMD="find"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you control distribution and set only POSIX-compliant maybe it is useless to overcomplexify there

FULL_FILE_PATTERN="${FILE_PREFIX}${FILE_PATTERNS[*]}"
# Build the find command
FIND_CMD="find"
FIND_FILE_CMD="$FIND_CMD $FILE_PATH_PATERN"' \( -name "*.hpp" -o -name "*.cpp" \)'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-type f

"mesh/*"
"physicsSolvers/*"
)
EXCLUDE_PATTERNS=(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indent ?

FULL_FILE_PATTERN="${FILE_PREFIX}${FILE_PATTERNS[*]}"
# Build the find command
FIND_CMD="find"
FIND_FILE_CMD="$FIND_CMD $FILE_PATH_PATERN"' \( -name "*.hpp" -o -name "*.cpp" \)'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Beware of template files, they should be included

/*
* ------------------------------------------------------------------------------------------------------------
* SPDX-License-Identifier: LGPL-2.1-only
*
* Copyright (c) 2018-2019 Lawrence Livermore National Security LLC
* Copyright (c) 2018-2019 The Board of Trustees of the Leland Stanford Junior University
* Copyright (c) 2018-2019 Total, S.A
* Copyright (c) 2019- GEOSX Contributors
* All right reserved
*
* See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details.
* ------------------------------------------------------------------------------------------------------------
*/
/**
* @file @[email protected]
*/
#ifndef GEOS_@KERNEL_GROUP_NAME@_DISPATCHTYPELIST_HPP
#define GEOS_@KERNEL_GROUP_NAME@_DISPATCHTYPELIST_HPP
#include "common/TypeDispatch.hpp"
namespace geos
{
// TODO remove and find a proper solution to namespacing
using namespace constitutive;
using namespace finiteElement;
using @KERNEL_GROUP_NAME@DispatchTypeList = types::TypeList<
@typeCombinationList@
>;
} // namespace geos
#endif //GEOS_@KERNEL_GROUP_NAME@_DISPATCHTYPELIST_HPP

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

DO NOT MERGE ! flag: no rebaseline Does not require rebaseline type: CI Concerns github workflows or generic CI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants